import mutiyi.MQClient;

/**
 * Author:yang
 * Date:2024-03-06 11:09
 */
public class Main {
  public static void main(String[] args) {
    String broker = "tcp://127.0.0.1:1883";
    String clientId = "BlessSusu";
    MQClient mqttClient = new MQClient(broker, clientId);

    // 连接到MQTT代理
    mqttClient.connect();

    // 订阅主题
    String topic = "muti_yi";
    mqttClient.subscribe(topic);

    // 发布消息
    String message = "Hello!";
    mqttClient.publish(topic, message);

    // 断开连接
    mqttClient.disconnect();
  }
}
